/************************************************************************/
/* 
lavf audio codec setting class
author pengl
date 2008-11-26
*/
/************************************************************************/


#include "StdAfx.h"
#include ".\clavfacodec_opts.h"
#include <stdio.h>

static char *glavfacodec_name = "lavfacodec";
static char glavfacodec_opts[1024] = {0};


clavfacodec_opts::clavfacodec_opts(void)
{
}

clavfacodec_opts::~clavfacodec_opts(void)
{
}



char *clavfacodec_opts::get_myname() const
{
	return glavfacodec_name;
}

void clavfacodec_opts::set_lavfacodec_opts(Ps_lavfacodec_opts opts)
{
	m_s_lavfacodec_opts = *opts;
}

char *clavfacodec_opts::get_lavfacodec_opts()
{
	int flags;
	char acodec[20] = {0};
	flags = m_s_lavfacodec_opts.acodec_name;
	switch(flags) {
	case lavf_mp2:
		sprintf(acodec, "%s", "mp2");
		break;
	case lavf_mp3:
		sprintf(acodec, "%s", "mp3");
		break;
	case lavf_ac3:
		sprintf(acodec, "%s", "ac3");
		break;
	case lavf_aac:
		sprintf(acodec, "%s", "aac");
		break;
	default:
		sprintf(acodec, "%s", "mp3");
	}
	sprintf(glavfacodec_opts, "-oac lavc -lavcopts acodec=%s:abitrate=%d ",
			acodec,
			m_s_lavfacodec_opts.lavf_bitrate);

	return glavfacodec_opts;
}


